<div style="margin-left: 40px; text-align: left;">
  <div style="margin-left: 40px;">
    <a id="start" href="a">test<br></a>
  </div>
  <a id="2" href="a">test</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="3" href="a">test</a><br>
  <div style="margin-left: 40px;">
    <a id="4" href="a">test<br></a>
  </div>
  <div style="margin-left: 80px;">
    <a id="5" href="a">test<br></a>
  </div>
  <div style="margin-left: 40px;">
    <a id="6" href="a">test<br></a>
  </div>
  <a id="7" href="a">test<br></a>
  <br><br><br><br>
  <div style="margin-left: 40px;">
    <a id="8" href="a">test<br></a>
  </div>
  <a id="end" href="a">test<br></a>
</div>

<p>This test ensures the correctness of the "Fully aligned" precedence logic implemented by Spatial Navigation algorithm in an vertical direction: targets whose middle falls between the top and bottom of the current focused element are preferably to move focus to, even if it is not the shortest distance.</p>

<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="resources/snav-testharness.js"></script>
<script>
  var resultMap = [
    ["Down", "4"],
    ["Down", "6"],
    ["Down", "7"],
    ["Down", "end"],
    ["Up", "8"],
    ["Up", "6"],
  ];

  // Start at a known place.
  document.getElementById("start").focus();
  snav.assertFocusMoves(resultMap);
</script>
